package cn.ctyun.ipush.web.user.dao;

import cn.ctyun.ipush.web.user.bo.MenuUserNode;
import com.dexcoder.dal.JdbcDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Created by yanghongbo on 2016/7/11.
 */
@Component
public class MenuUserDao {
    @Autowired
    private JdbcDao jdbcDao;

    public List<MenuUserNode> listAll(MenuUserNode MenuUserNode){

        try{
            List list = jdbcDao.queryList(MenuUserNode);

            return  list;
        }catch (Exception e){
            return null;
        }

    }
    public MenuUserNode querySingleMenu(MenuUserNode MenuUserNode){

        try{
            MenuUserNode tmp = jdbcDao.querySingleResult(MenuUserNode);

            return  tmp;
        }catch (Exception e){
            return null;
        }

    }
    public boolean saveMenu(MenuUserNode MenuUserNode){
        try{
            jdbcDao.save(MenuUserNode);
            return true;
        }catch (Exception e){
            return false;
        }
    }
    public boolean deleteMenu(MenuUserNode MenuUserNode){
        try{
            jdbcDao.delete(MenuUserNode);
            return true;
        }catch (Exception e){
            return false;
        }
    }
}
